package com.forecasting.utility;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;

public class NormalDistributionExtractor implements Serializable {
	private File f = null;
	private Scanner sc = null;
	private Map<Double,Double> zMap = new HashMap<Double,Double>();
	private NavigableMap<Double,Double> slMap = new TreeMap<Double,Double>();
	
	public NormalDistributionExtractor(){
		try{
			f = new File("TextDB\\TableauNormalDistribution.txt");
			sc = new Scanner(f);
			String line = null;
			Double n1 = 0.0;
			Double n2 = 0.0;
			while(sc.hasNextLine()){
				line = sc.nextLine();
				String[] linesplit = line.split("\t");
				//linesplit[1] = linesplit[1].substring(0, linesplit[1].length() - 1);
				n1 = Double.parseDouble(linesplit[0]);
				n2 = Double.parseDouble(linesplit[1]);
				zMap.put(n2, n1);
				slMap.put(n1, n2);
			}
		}catch(IOException ioe){
			
		}	
	}
	public Map<Double,Double> getZStatMap(){
		
		return zMap;
	}
	public NavigableMap<Double,Double> getServiceLevelMap(){
		
		return slMap;
	}
		
}
